#ifndef PLAYER_H
#define PLAYER_H

#include "raylib.h"
#include "ConfigManager.h"
#include "board.h"
#include <string>

class Player {
private:
    Vector2 position;
    Vector2 size;
    float velocityY;
    const GameConfig& config;
    
    // 添加血量系统相关属性
    int health;                 // 玩家血量
    bool onBreakableBoard;      // 是否在可破坏板子上
    
    // 添加分数系统相关属性
    int currentScore;           // 当前分数
    int highScore;              // 历史最高分
    
public:
    Player(float x, float y, const GameConfig& gameConfig);
    
    void Update();
    void Draw();
    void Reset();
    
    // 碰撞处理
    void HandleBoardCollision(float boardTopY);
    void HandleBreakableBoardCollision(float boardY);
    void HandleSpikyBoardCollision(float boardY); // 处理尖刺板碰撞
    
    // 血量系统相关方法
    void DecreaseHealth(int amount);
    void SetOnBreakableBoard(bool onBreakable);
    bool IsAlive() const;
    
    // 分数系统相关方法
    void IncreaseScore(int amount);
    void SaveHighScore();
    void LoadHighScore();
    
    // Getters
    Vector2 GetPosition() const { return position; }
    Vector2 GetSize() const { return size; }
    float GetVelocityY() const { return velocityY; }
    Rectangle GetRect() const { return Rectangle{position.x, position.y, size.x, size.y}; }
    int GetHealth() const { return health; }
    int GetCurrentScore() const { return currentScore; }
    int GetHighScore() const { return highScore; }
    
    // Setters
    void SetHealth(int newHealth) { health = newHealth; }
    void SetHighScore(int newHighScore) { highScore = newHighScore; }
};

#endif // PLAYER_H